#ifndef EMCMOTIONINTERFACE_H
#define EMCMOTIONINTERFACE_H

#include "mot_priv.h"

class EmcMotionInterface
{
public:
    EmcMotionInterface();

public:
    /***********************************************************************
    *                    PUBLIC FUNCTION PROTOTYPES                        *
    ************************************************************************/

    /* function definitions */
     void emcmotCommandHandler(void *arg, long period);
     void emcmotController(void *arg, long period);
     void emcmotSetCycleTime(unsigned long nsec);

    /* these are related to synchronized I/O */
     void emcmotDioWrite(int index, char value);
     void emcmotAioWrite(int index, double value);

     void emcmotSetRotaryUnlock(int axis, int unlock);
     int emcmotGetRotaryIsUnlocked(int axis);

    //
    // Try to change the Motion mode to Teleop.
    //
    // This function can be called at any time.  Returns without changing
    // mode if Teleop is not currently allowed.  This code doesn't actually
    // make the transition, it just sets a flag requesting the transition.
    // The real transition to Teleop mode is done in emcmotController().
    //
    void switch_to_teleop_mode(void);

    /* loops through the active joints and checks if any are not homed */
     bool checkAllHomed(void);
    /* recalculates jog limits */
     void refresh_jog_limits(emcmot_joint_t *joint,int joint_num);
    /* handles 'homed' flags, see command.c for details */
     void clearHomes(int joint_num);

     void emcmot_config_change(void);
//     void reportError(const char *fmt, ...) __attribute((format(printf,1,2))); /* Use the rtapi_print call */

    int joint_is_lockable(int joint_num);

     int joint_jog_ok(int joint_num, double vel);

};

#endif // EMCMOTIONINTERFACE_H
